<%@ page language="java" import="java.util.*"
         contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<%@ include file="/common/meta.jsp"%>
<title></title>
    <link href="${ctx }/css/select.css" rel="stylesheet"/>
    <link href="${ctx }/css/matials.css" rel="stylesheet"/>
    <script type="text/javascript" src="${ctx }/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="${ctx }/js/select-ui.min.js"></script>
    <script type="text/javascript" src="${ctx }/editor/kindeditor.js"></script>
    <script type="text/javascript" src="${ctx }/js/matials.js"></script>
  
</head>

<body class="sarchbody">

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="#">资料管理</a></li>
    </ul>
</div>

<div class="formbody">
    <div id="usual1" class="usual">
        <ul class="seachform1">
            <li><label>资料编号</label><input id="id" name="id" type="text" class="scinput1"/></li>
            <li><label>资料名</label><input id="matName" name="matName" type="text" class="scinput1"/></li>
            <li><label>资料类型</label>
              <div class="vocation">
	                    <select class="select3" id="matType" name="matType" id="matType">
	                    	<option value="全部">全部</option>
	                        <option value="图片">图片</option>
	                        <option value="视屏">视屏</option>
	                        <option value="文档">文档</option>
	                        <option value="软件">软件</option>
	                    </select>
	                </div>
        </ul>
         <ul class="seachform2">
            <li><label>所属课程</label>
                <div class="vocation">
                    <select class="select3" name="courseName" id="courseName">
                    	<option>全部</option>
                        <option>数学</option>
                        <option>语文</option>
                    </select>
                </div>
            </li>

        </ul>
        

        <!--按钮-->
        <ul class="seachform1">
            <li class="sarchbtn"><label>&nbsp;</label>
                <input name="" type="button" class="scbtn" value="查询"/>
             
                <input name="" type="button" class="scbtn2" value="导出"/>
                <input name="" type="button" class="addCourse" value="添加资料"/>
                <input name="" type="button" class="delSelect" value="删除选中"/>
            </li>
        </ul>

        <div class="formtitle"><span>资料管理</span></div>
        <table class="tablelist">
            <thead>
            <tr>
            	
                <th><input id="checkAll"  name="" type="checkbox" value=""/></th>
                <th>资料编号</th>
                <th>资料名称</th>
                <th>资料类型</th>
                <th>所属课程</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${pager.list}" var="item" varStatus="status">
	            <tr >
	                <td><input index=${item.id} name="subCheckBox" type="checkbox" value=""/></td>
	                <td>${item.id}</td>
	                <td>${item.matName}</td>
	                <td>${item.matType}</td>
	                <td>${item.cId}</td>
	                <td>
	                    <a href="${ctx }/material/${item.id}/delete?currentPage=${pager.pageControl.currentIndex}" class="tablelink"> 删除</a>&nbsp;|
	                    <a href="#" class="tablelink"> 修改</a>&nbsp;|
	                    <a href="#" class="tablelink">查看相关资料</a>&nbsp;|
	                    <a href="#" class="tablelink"> 添加学员</a>&nbsp;|
	                </td>
	            </tr>
            </c:forEach>
            
            

			
            
            </tbody>
        </table>
       
    </div>
     <!--在此制作页码的基本结构-->
<div class="page">
	<c:if test="${pager.pageControl.sumPage!=0}" var="pageFlag">
		<a class="unaction">共计：${pager.pageControl.sumPage}页/${pager.pageControl.sumCount}条记录</a>
		<a href="${ctx }/material/list?currentPage=1">首页</a>
		<c:if test="${pager.pageControl.currentIndex==1}" var="fp">
			<a style="disabled:true"  class="unaction">上一页</a>
		</c:if>	
		<c:if test="${!fp}">
			<a href="${ctx }/material/list?currentPage=${pager.pageControl.currentIndex-1}">上一页</a>
		</c:if>		
		
		<c:forEach begin="${pager.pageControl.minPage}" step="1" end="${pager.pageControl.maxPage}" var="index">
								
			<c:if test="${pager.pageControl.currentIndex==index}" var="t">
				<a class="active">${index}</a>
			</c:if>
			<c:if test="${!t}">
			<a href="${ctx }/material/list?currentPage=${index}">${index}</a>
			</c:if>
		</c:forEach>
		<a href="${ctx }/material/list?currentPage=${pager.pageControl.maxPage}">末页</a>
		
		<c:if test="${pager.pageControl.currentIndex==pager.pageControl.sumPage}" var="fp">
			<a style="disabled:true"  class="unaction">下一页</a>
		</c:if>	
		<c:if test="${!fp}">
			<a href="${ctx }/material/list?currentPage=${pager.pageControl.currentIndex+1}">下一页</a>
		</c:if>	
	</c:if><!-- 总页数是否为零  -->
	<c:if test="${!pageFlag}">
		<h1>没有记录</h1>
	
	</c:if>
				

</div>
</div>

<!--添加资料的弹出框-->

<div class="addCoursetip">
<form method="post" action="${ctx }/material/add" enctype="multipart/form-data">
    <div class="tiptop"><span>添加资料</span><a class="close"></a></div>
	
    <div class="tipinfo">
    	
        <ul>
	            <li>
	                <div class="word">资料名称</div>
	                <input id="matName" name="matName" type="text" class="scinput1"/></li>
	            <li>
	                <div class="word">资料类型</div>
	                <div class="vocation">
	                    <select class="select3" id="matType" name="matType">
	                        <option value="图片">图片</option>
	                        <option value="视屏">视屏</option>
	                        <option value="文档">文档</option>
	                        <option value="软件">软件</option>
	                    </select>
	                </div>
	            </li>
	            <li><br><br></li>
	            <li>
	                <div class="word">所属课程</div>
	                <div class="vocation">
	                    <select class="select3" id="cId">
	                        <option>语文</option>
	                        <option>数学</option>
	                    </select>
	                </div>
	            </li>
	            <li><br><br></li>
	            <li>
	            	<div class="word">文件上传</div>
	                <input id="matUrl" name="file" type="file"/>
	            </li>
        </ul>
        <c:set value="${pager.pageControl.maxPage==pager.pageControl.currentIndex and pager.pageControl.sumCount%pager.pageControl.pagesize==0}" var="goMaxPageFlag"></c:set>
        <c:if test="${goMaxPageFlag}">
     		<input type="hidden" value="${pager.pageControl.sumPage+1}" name="currentPage"/>
     	</c:if>   <!-- 添加最大页的最后一条记录 -->
     	 <c:if test="${!goMaxPageFlag}">
     	 	<input type="hidden" value="${pager.pageControl.sumPage}" name="currentPage"/>
     	 </c:if>
    </div>

    <div class="tipbtn">
        <input id="submitBtn" type="submit" class="sure" value="添加"/>&nbsp;
        <input name="" type="button" class="cancel" value="取消"/>
    </div>
</form>
</div>

</body>

</html>
